package com.nl.strings;

import java.util.Arrays;

public class FirstOnlyOnceChar {

	public static Character firstOnceChar(char[] chars){
		
		if(chars==null){
			return null;
		}
		
		int[] ascArr = new int[256];
		Arrays.fill(ascArr, 0);
		for(char c :chars){
			ascArr[(int)c] +=1;
		}
		Character result=null; 
		for(char c :chars){
			if(ascArr[(int)c]==1){
				result = c;
				break;
			}
		}
		return result;
	}
	
	public static void main(String[] args) {
		System.out.println(firstOnceChar(new char[]{'a','c','a','c','b'}));
	}
}
